import java.awt.Color;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;

import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.plaf.ColorUIResource;

/**
 * @author Raghav A0091578R
 */

// Creates the UserInterface for EZTask
public class UI extends JFrame {

	public final String COMMAND_ADD = "ADD ";
	public final String COMMAND_EDIT = "EDIT ";
	public final String COMMAND_GOTO = "GOTO ";
	public final String COMMAND_DELETE = "DELETE ";
	public final String COMMAND_UNDO = "UNDO ";
	public final String COMMAND_SEARCH = "SEARCH ";
	public final String COMMAND_COMPLETE = "COMPLETE ";
	public final String COMMAND_CLEAR_LOG = "CLEAR LOG";
	public final String COMMAND_CLEAR_COMPLETED_TASKS = "CLEAR COMPLETED TASKS";
	public final String COMMAND_CLEAR = "CLEAR ";
	public final String IMAGE_URL = "GUI Image.jpg";

	public UI() {

		initComponents();
		initFrame();
		setLogo();
		launchHelp();
		autoFillKeyword();
		// keyboardShortcuts();
		// resizeFrame();
		menuBarActions();
		closingConfirmation();
	}

	public void initFrame() {

		super.setTitle("EZTask");
		super.setLocation(350, 50);
		super.setResizable(false);
		super.setVisible(true);
	}

	public String getCommandLine() {

		return cmdLine.getText();
	}

	private String convertDateToUserFriendlyFormat(String date) {

		String convertedDate = "", month = "";
		String yyyy = date.substring(0, 4);
		String mm = date.substring(4, 6);
		String dd = date.substring(6, 8);

		switch (mm) {

		case "01":
			month = "Jan";
			break;
		case "02":
			month = "Feb";
			break;
		case "03":
			month = "Mar";
			break;
		case "04":
			month = "Apr";
			break;
		case "05":
			month = "May";
			break;
		case "06":
			month = "Jun";
			break;
		case "07":
			month = "Jul";
			break;
		case "08":
			month = "Aug";
			break;
		case "09":
			month = "Sep";
			break;
		case "10":
			month = "Oct";
			break;
		case "11":
			month = "Nov";
			break;
		case "12":
			month = "Dec";
			break;
		default:
			break;
		}

		convertedDate = dd + "-" + month + "-" + yyyy;
		return convertedDate;
	}

	private String convertTimeToUserFriendlyFormat(String time) {

		String convertedTime = "", hour = "", minutes = "";
		hour = time.substring(0, 2);
		minutes = time.substring(2, 4);

		int hourInt = Integer.parseInt(hour);
		boolean isPastNoon;
		isPastNoon = (hourInt > 12) ? true : false;
		String ampm = "am";

		if (isPastNoon) {

			hourInt -= 12;
			ampm = "pm";
		}

		convertedTime = hourInt + ":" + minutes + " " + ampm;

		return convertedTime;
	}

	private String convertTaskCompletionToUserFriendlyFormat(String isCompleted) {

		String taskStatus = "";
		taskStatus = isCompleted == "true" ? "=)" : "=-O";

		return taskStatus;
	}

	public void resizeFrame() {

		super.setState(JFrame.ICONIFIED);
	}

	/*
	 * public void keyboardShortcuts() {
	 * 
	 * super.addKeyListener(new KeyListener() {
	 * 
	 * @Override public void keyPressed(KeyEvent arg0) { // TODO Auto-generated
	 * method stub if(arg0.getKeyCode() == KeyEvent.VK_M) { resizeFrame(); } }
	 * 
	 * 
	 * 
	 * @Override public void keyTyped(KeyEvent e) {
	 * 
	 * 
	 * }
	 * 
	 * 
	 * 
	 * @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated
	 * method stub
	 * 
	 * }
	 * 
	 * 
	 * }); }
	 */

	public void setCommandLine(String text) {

		cmdLine.setText(text);
	}

	public String getUserInput() {
		ActionListener al_cmdLine = new ActionListener() {
			public void actionPerformed(ActionEvent e) {

				command = cmdLine.getText();
				cmdLine.setText("");
			}
		};
		cmdLine.addActionListener(al_cmdLine);
		// System.out.print(command);
		return command;
	}

	public void setLogo() {

		// logo.setIcon(new ImageIcon(IMAGE_URL));
	}

	public void clearLog() {

		log.setText("");
	}

	public void launchHelp() {
		ActionListener al_help = new ActionListener() {
			public void actionPerformed(ActionEvent e) {

				try {
					Runtime.getRuntime().exec(
							"rundll32 url.dll,FileProtocolHandler "
									+ "[t14-4j][V0.1].pdf");
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		};
		help.addActionListener(al_help);
	}

	// automatically enters the keyword when selected from the keywords list
	public void autoFillKeyword() {

		ListSelectionListener al_keyword = new ListSelectionListener() {

			@Override
			public void valueChanged(ListSelectionEvent e) {
				// TODO Auto-generated method stub
				cmdLine.setFont(new java.awt.Font("Comic Sans MS", 1, 14));
				int index = keywordsList.getSelectedIndex();
				switch (index) {
				case 0:
					cmdLine.setText(COMMAND_ADD);
					break;
				case 1:
					cmdLine.setText(COMMAND_EDIT);
					break;
				case 2:
					cmdLine.setText(COMMAND_DELETE);
					break;
				case 3:
					cmdLine.setText(COMMAND_UNDO);
					break;
				case 4:
					cmdLine.setText(COMMAND_GOTO);
					break;
				case 5:
					cmdLine.setText(COMMAND_SEARCH);
					break;
				case 6:
					cmdLine.setText(COMMAND_COMPLETE);
					break;
				case 7:
					cmdLine.setText(COMMAND_CLEAR);
					break;

				default:
					assert false : cmdLine;
					throw new AssertionError(cmdLine);

				}
			}
		};
		keywordsList.addListSelectionListener(al_keyword);
	}

	public void displayCalList(String[][] list) {

		calListModel.clear();
		for (int i = 0; i < list.length; i++) {

			String index = list[i][0];
			String desc = list[i][1];
			String date = list[i][2];
			String time = list[i][3];
			String taskStatus = list[i][4];

			date = convertDateToUserFriendlyFormat(date);
			time = convertTimeToUserFriendlyFormat(time);
			taskStatus = convertTaskCompletionToUserFriendlyFormat(taskStatus);

			String line = index + ". " + desc + "  " + date + "  " + time + " "
					+ taskStatus + "\n";

			if (taskStatus == "false") {

				calListBox.setSelectedIndex(i);
				if (calListBox.isSelectedIndex(i))
					setForeground(Color.green);

			}

			calListModel.addElement(line);
		}
	}

	public void displayPrioList(String[][] list) {

		prioListModel.clear();
		for (int i = 0; i < list.length; i++) {

			String index = list[i][0];
			String desc = list[i][1];
			String prio = list[i][2];
			String taskStatus = list[i][3];

			taskStatus = convertTaskCompletionToUserFriendlyFormat(taskStatus);

			String line = index + ". " + desc + "  " + prio + "  " + taskStatus
					+ "\n";

			switch (prio) {
			case "1":
				prio = "Low";
				break;
			case "2":
				prio = "Medium";
				break;
			case "3":
				prio = "High";
				break;
			default:
				assert false : prio;
				throw new AssertionError(prio);
			}

			prioListModel.addElement(line);
			/*
			 * prioListBox.setText(prioListBox.getText() + index + ". " + desc +
			 * "  " + prio + "  " + isCompleted + "\n");
			 */
		}

	}

	public void displayLog(String something) {

		log.setText(log.getText() + something + "\n");
	}

	public void menuBarActions() {

		ActionListener menuActions = new ActionListener() {

			public void actionPerformed(ActionEvent event) {

				if (event.getSource() == calTaskAdd) {

					cmdLine.setText("ADD <desc>;<date>;<time>");
				}
				if (event.getSource() == prioTaskAdd) {

					cmdLine.setText("ADD <desc>;<prio>");
				}
				if (event.getSource() == calTaskEdit) {

					cmdLine.setText("EDIT <index>;<desc>;<date>;<time>");
				}
				if (event.getSource() == prioTaskEdit) {

					cmdLine.setText("EDIT <index>;<desc>;<prio>");
				}
				if (event.getSource() == calTaskDelete) {

					cmdLine.setText("DELETE C <index>");
				}
				if (event.getSource() == prioTaskDelete) {

					cmdLine.setText("DELETE P <index>");
				}
				if (event.getSource() == calTaskGoTo) {

					cmdLine.setText("GOTO <date>");
				}
				if (event.getSource() == prioTaskGoTo) {

					cmdLine.setText("GOTO <priority>");
				}
				if (event.getSource() == todayGoTo) {

					cmdLine.setText("GOTO c today");
				}
				if (event.getSource() == helpMenuItem) {
					try {
						Runtime.getRuntime().exec(
								"rundll32 url.dll,FileProtocolHandler "
										+ "[t14-4j][V0.1].pdf");
					} catch (IOException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}
				if (event.getSource() == completeCalTaskMenuItem) {

					cmdLine.setText("COMPLETE c <index>");
				}
				if (event.getSource() == completePrioTaskMenuItem) {

					cmdLine.setText("COMPLETE p <index>");
				}
				if (event.getSource() == searchMenuItem) {

					cmdLine.setText(COMMAND_SEARCH);
				}
				if (event.getSource() == clearLogMenuItem) {

					// cmdLine.setText(COMMAND_CLEAR_LOG);
					clearLog();
				}
				if (event.getSource() == clearCompTasksMenuItem) {

					cmdLine.setText(COMMAND_CLEAR);
				}
				if (event.getSource() == exitMenuItem) {

					System.exit(0);
				}
			}
		};

		calTaskAdd.addActionListener(menuActions);
		prioTaskAdd.addActionListener(menuActions);
		calTaskEdit.addActionListener(menuActions);
		prioTaskEdit.addActionListener(menuActions);
		calTaskDelete.addActionListener(menuActions);
		prioTaskDelete.addActionListener(menuActions);
		calTaskGoTo.addActionListener(menuActions);
		prioTaskGoTo.addActionListener(menuActions);
		todayGoTo.addActionListener(menuActions);
		exitMenuItem.addActionListener(menuActions);
		helpMenuItem.addActionListener(menuActions);
		completeCalTaskMenuItem.addActionListener(menuActions);
		completePrioTaskMenuItem.addActionListener(menuActions);
		clearCompTasksMenuItem.addActionListener(menuActions);
		clearLogMenuItem.addActionListener(menuActions);
		searchMenuItem.addActionListener(menuActions);
	}

	public void closingConfirmation() {

		super.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				int confirmed = JOptionPane.showConfirmDialog(null,
						"Are you sure you want to exit?", "User Confirmation",
						JOptionPane.YES_NO_OPTION);
				if (confirmed == JOptionPane.YES_OPTION) {
					System.exit(0);
				} else {
					assert confirmed == JOptionPane.NO_OPTION : confirmed;
				}
				assert false : confirmed;
			}
		});
	}

	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		panel = new javax.swing.JPanel();
		cmdLine = new javax.swing.JTextField();
		logScrollPane = new javax.swing.JScrollPane();
		log = new javax.swing.JTextArea();
		logo = new javax.swing.JLabel();
		keywords = new javax.swing.JTextField();
		calListTextField = new javax.swing.JTextField();
		prioListTextField = new javax.swing.JTextField();
		help = new javax.swing.JButton();
		keywordsPane = new javax.swing.JScrollPane();
		keywordsList = new javax.swing.JList();
		calListPane = new javax.swing.JScrollPane();
		calListModel = new DefaultListModel();
		calListBox = new javax.swing.JList(calListModel);
		prioListPane = new javax.swing.JScrollPane();
		prioListModel = new DefaultListModel();
		prioListBox = new javax.swing.JList(prioListModel);

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

		panel.setBackground(new java.awt.Color(50, 50, 50));

		cmdLine.setBackground(new java.awt.Color(204, 204, 204));
		cmdLine.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
		cmdLine.setForeground(new java.awt.Color(50, 50, 50));
		logScrollPane.setBackground(new java.awt.Color(75, 9, 9));
		logScrollPane.setForeground(new java.awt.Color(218, 192, 192));
		logScrollPane
				.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		logScrollPane.setCursor(new java.awt.Cursor(
				java.awt.Cursor.DEFAULT_CURSOR));
		logScrollPane
				.setDebugGraphicsOptions(javax.swing.DebugGraphics.LOG_OPTION);

		log.setBackground(new java.awt.Color(204, 204, 204));
		log.setColumns(20);
		log.setFont(new java.awt.Font("Comic Sans MS", 1, 13)); // NOI18N
		log.setForeground(new java.awt.Color(50, 50, 50));
		log.setRows(5);
		logScrollPane.setViewportView(log);

		logo.setBackground(new java.awt.Color(204, 204, 204));
		logo.setBorder(javax.swing.BorderFactory
				.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
		logo.setCursor(new java.awt.Cursor(java.awt.Cursor.CROSSHAIR_CURSOR));

		keywords.setEditable(false);
		keywords.setBackground(new java.awt.Color(0, 0, 0));
		keywords.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
		keywords.setForeground(new java.awt.Color(240, 240, 240));
		keywords.setHorizontalAlignment(javax.swing.JTextField.CENTER);
		keywords.setText("Keywords");

		calListTextField.setEditable(false);
		calListTextField.setBackground(new java.awt.Color(0, 0, 0));
		calListTextField.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
		calListTextField.setForeground(new java.awt.Color(255, 255, 255));
		calListTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
		calListTextField.setText("Calendar List");

		prioListTextField.setEditable(false);
		prioListTextField.setBackground(new java.awt.Color(0, 0, 0));
		prioListTextField.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
		prioListTextField.setForeground(new java.awt.Color(255, 255, 255));
		prioListTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
		prioListTextField.setText("Priority List");

		help.setBackground(new java.awt.Color(0, 0, 0));
		help.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
		help.setForeground(new java.awt.Color(255, 255, 255));
		help.setText("Help");

		keywordsList.setBackground(new java.awt.Color(50, 50, 50));
		keywordsList.setFont(new java.awt.Font("Comic Sans MS", 1, 14)); // NOI18N
		keywordsList.setForeground(new java.awt.Color(204, 204, 204));
		keywordsList.setModel(new javax.swing.AbstractListModel() {
			String[] strings = { "ADD", "EDIT", "DELETE", "UNDO", "GOTO",
					"SEARCH", "COMPLETE", "CLEAR" };

			public int getSize() {
				return strings.length;
			}

			public Object getElementAt(int i) {
				return strings[i];
			}
		});
		keywordsPane.setViewportView(keywordsList);

		calListBox.setBackground(new java.awt.Color(204, 204, 204));
		calListBox.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
		calListBox.setForeground(new java.awt.Color(50, 50, 50));
		calListPane.setViewportView(calListBox);

		prioListBox.setBackground(new java.awt.Color(204, 204, 204));
		prioListBox.setFont(new java.awt.Font("Comic Sans MS", 1, 12)); // NOI18N
		prioListBox.setForeground(new java.awt.Color(50, 50, 50));
		prioListPane.setViewportView(prioListBox);

		javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(panel);
		panel.setLayout(panelLayout);
		panelLayout
				.setHorizontalGroup(panelLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addComponent(cmdLine)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								panelLayout
										.createSequentialGroup()
										.addGroup(
												panelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																calListTextField)
														.addComponent(
																calListPane,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																387,
																Short.MAX_VALUE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												panelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																prioListPane,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																253,
																Short.MAX_VALUE)
														.addComponent(
																prioListTextField))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												panelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addComponent(
																help,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE)
														.addComponent(
																keywords,
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																keywordsPane,
																javax.swing.GroupLayout.Alignment.TRAILING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																103,
																Short.MAX_VALUE)
														.addComponent(
																logo,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE)))
						.addComponent(logScrollPane));
		panelLayout
				.setVerticalGroup(panelLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								panelLayout
										.createSequentialGroup()
										.addGroup(
												panelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING,
																false)
														.addComponent(
																calListTextField,
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																panelLayout
																		.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.BASELINE)
																		.addComponent(
																				keywords)
																		.addComponent(
																				prioListTextField)))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												panelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																panelLayout
																		.createSequentialGroup()
																		.addComponent(
																				keywordsPane,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				207,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				help)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				logo,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				117,
																				Short.MAX_VALUE))
														.addComponent(
																calListPane)
														.addComponent(
																prioListPane))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												logScrollPane,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												82,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												cmdLine,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												49,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addGap(7, 7, 7)));

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(panel,
				javax.swing.GroupLayout.DEFAULT_SIZE,
				javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
		layout.setVerticalGroup(layout.createParallelGroup(
				javax.swing.GroupLayout.Alignment.LEADING).addComponent(panel,
				javax.swing.GroupLayout.DEFAULT_SIZE,
				javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

		jmb = new JMenuBar();
		super.setJMenuBar(jmb);
		super.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);

		fileMenu = new JMenu("File");
		fileMenu.setMnemonic('f');
		helpMenu = new JMenu("Help");
		helpMenu.setMnemonic('h');

		jmb.add(fileMenu);
		jmb.add(helpMenu);

		addMenu = new JMenu("Add");
		editMenu = new JMenu("Edit");
		deleteMenu = new JMenu("Delete");
		goToMenu = new JMenu("Goto");
		completeMenu = new JMenu("Complete");
		clearMenu = new JMenu("Clear");
		searchMenuItem = new JMenuItem("Search");
		clearLogMenuItem = new JMenuItem("Log");
		clearCompTasksMenuItem = new JMenuItem("Completed Tasks");
		exitMenuItem = new JMenuItem("Exit", 'X');

		fileMenu.add(addMenu);
		fileMenu.add(editMenu);
		fileMenu.add(deleteMenu);
		fileMenu.add(goToMenu);
		fileMenu.addSeparator();
		fileMenu.add(searchMenuItem);
		fileMenu.add(completeMenu);
		fileMenu.addSeparator();
		fileMenu.add(clearMenu);
		fileMenu.addSeparator();
		fileMenu.add(exitMenuItem);

		calTaskAdd = new JMenuItem("Calendar Task");
		prioTaskAdd = new JMenuItem("Priority Task");
		calTaskDelete = new JMenuItem("Calendar Task");
		prioTaskDelete = new JMenuItem("Priority Task");
		calTaskEdit = new JMenuItem("Calendar Task");
		prioTaskEdit = new JMenuItem("Priority Task");
		calTaskGoTo = new JMenuItem("Calendar Task");
		prioTaskGoTo = new JMenuItem("Priority Task");
		todayGoTo = new JMenuItem("Today's tasks");
		completePrioTaskMenuItem = new JMenuItem("Priority Task");
		completeCalTaskMenuItem = new JMenuItem("Calendar Task");

		addMenu.add(calTaskAdd);
		addMenu.add(prioTaskAdd);
		editMenu.add(calTaskEdit);
		editMenu.add(prioTaskEdit);
		deleteMenu.add(calTaskDelete);
		deleteMenu.add(prioTaskDelete);
		goToMenu.add(calTaskGoTo);
		goToMenu.add(prioTaskGoTo);
		goToMenu.addSeparator();
		goToMenu.add(todayGoTo);
		completeMenu.add(completeCalTaskMenuItem);
		completeMenu.add(completePrioTaskMenuItem);
		clearMenu.add(clearCompTasksMenuItem);
		clearMenu.addSeparator();
		clearMenu.add(clearLogMenuItem);

		exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(
				java.awt.event.KeyEvent.VK_X, java.awt.Event.CTRL_MASK));

		helpMenuItem = new JMenuItem("User guide manual", 'u');
		helpMenu.add(helpMenuItem);

		pack();
	}// </editor-fold>

	// Variables declaration - do not modify
	private String command = "";
	private JMenuBar jmb;
	private JMenu fileMenu, helpMenu, addMenu, editMenu, completeMenu,
			deleteMenu, goToMenu, clearMenu;
	private JMenuItem clearLogMenuItem, clearCompTasksMenuItem, searchMenuItem,
			calTaskAdd, prioTaskAdd, calTaskDelete, prioTaskDelete,
			calTaskEdit, prioTaskEdit, calTaskGoTo, todayGoTo, prioTaskGoTo,
			completeCalTaskMenuItem, completePrioTaskMenuItem, helpMenuItem,
			exitMenuItem;
	private javax.swing.JList calListBox;
	private DefaultListModel calListModel;
	private DefaultListModel prioListModel;
	private javax.swing.JScrollPane calListPane;
	private javax.swing.JTextField calListTextField;
	private javax.swing.JTextField cmdLine;
	private javax.swing.JButton help;
	private javax.swing.JTextField keywords;
	private javax.swing.JList keywordsList;
	private javax.swing.JScrollPane keywordsPane;
	private javax.swing.JTextArea log;
	private javax.swing.JScrollPane logScrollPane;
	private javax.swing.JLabel logo;
	private javax.swing.JPanel panel;
	private javax.swing.JList prioListBox;
	private javax.swing.JScrollPane prioListPane;
	private javax.swing.JTextField prioListTextField;
	// End of variables declaration
}
